/*
 * protocol_model.h
 *
 *  Created on: 13.06.2013
 *      Author: SpirTanol
 */

#ifndef PROTOCOL_MODEL_H_
#define PROTOCOL_MODEL_H_

// QT
#include <QAbstractItemModel>
#include <QVector>

class ProtocolEvent;

class ProtocolModel : public QAbstractItemModel
{
	QVector<ProtocolEvent*> *oProtocol;

public:
	ProtocolModel(QVector<ProtocolEvent*> *protocol, QObject *parent);
	~ProtocolModel();

	int columnCount(const QModelIndex &parent = QModelIndex()) const; // [virtual]
	int rowCount(const QModelIndex &parent = QModelIndex()) const; // [virtual]

	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; // [virtual]
	QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; // [virtual]

	QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; // [virtual]
	QModelIndex parent(const QModelIndex &index) const; // [virtual]
	bool hasChildren(const QModelIndex &parent = QModelIndex()) const; // [virtual]

	Qt::ItemFlags flags(const QModelIndex &index) const; // [virtual]

	ProtocolEvent *eventOf(const QModelIndex &index) const;

	void updateProtocol();

};

#endif /* PROTOCOL_MODEL_H_ */
